package com.sooncode.project.focusservice.service;

import com.sooncode.project.core.finder.Finder;
import com.sooncode.project.core.finder.Page;
import com.sooncode.project.focusservice.model.CourseScriptType;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class CourseSctiptTypeService {
    public boolean add(Map<String,Object> map){
        CourseScriptType model=new CourseScriptType();
        model.add(map);
        return true;
    }
    public boolean modify(String id,Map<String,Object> map){
        CourseScriptType model=getById(id);
        model.modify(map);
        return true;
    }
    public boolean delete(String id){
        CourseScriptType model=getById(id);
        model.delete();
        return true;
    }
    public Page<CourseScriptType> getPageList( int pageSize, int pageIndex, Map<String,Object> map) {
        return new Finder<>(CourseScriptType.class)
            .byMap(map)
            .page(pageSize,pageIndex);
    }
    public List<CourseScriptType> getList(){
        return new Finder<>(CourseScriptType.class).list();
    }
    public CourseScriptType getById(String id){
        return new Finder<>(CourseScriptType.class).byId(id);
    }
}
